<template>
  <div class="cook" v-if="isShow">
    <div class="cook-content">
      <div class="image-header">
        <div class="imgs">
          <img
            :src="cook.default_image"
            alt=""
            :class="{ combo: cook.combo_type }"
          />
        </div>
        <div class="back" @click="toggleShow">
          <div class="is-left">
            <a-icon
              class="left"
              type="left"
              @click="$router.push({ name: 'shipu' },
              onComplete => {},onAbort => {})"
            />
          </div>
        </div>
      </div>
      <div class="contents" style="height: 50%">
        <h1 class="title">{{ cook.name }}</h1>
        <span>{{ cook.content }}</span>
      </div>
      <button type="text" @click="$router.push({ name: 'Home' })">
        材料购买
      </button>
    </div>
    <div class="cook-cover" @click="toggleShow"></div>
  </div>
</template>


<script>
export default {
  props: {
    cook: Object,
  },

  data() {
    return {
      isShow: false,
    };
  },

  methods: {
    toggleShow() {
      this.isShow = !this.isShow;
    },
  },
};
</script>
<style lang="scss"  scoped>
.cook {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 48px;
  // z-index: 101;
  width: 100%;
  // &.fade-enter-active,
  // &.fade-leave-active {
  //   transition: opacity 0.5s;
  // }
  // &.fade-enter,
  // &.fade-leave-to {
  //   opacity: 0;
  // }
  .cook-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: 66;
    background: bisque;
    border-radius: 5px;
    .image-header {
      position: relative;
      width: 100%;
      padding-top: 73%;
      img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 80%;
      }
      .back {
        position: absolute;
        top: 10px;
        left: 0;
        .left {
          display: block;
          padding: 10px;
          font-size: 20px;
          color: rgb(102, 240, 102);
        }
      }
      .contents {
        position: relative;
        padding: 10px;
        // height: 50%;
        .title {
          line-height: 14px;
          // margin-bottom: 1px;
          margin-top: 8px;
          font-size: 14px;
          font-weight: 700;
          color: rgb(7, 17, 27);
        }
      }
      .cook-cover {
        position: absolute;
        top: 0;
        right: 0;
        bottom: -10px;
        left: 0;
        z-index: 55;
        background-color: rgba(0, 0, 0, 0.5);
      }
    }
    button {
      background: rgb(238, 212, 96);
      float: right;
    }
  }
}
</style>
